var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var cors = require('cors')

app.use(cors())

app.get('/', function(req, res){
    res.send('<h1>Hello Conf</h1>');
  });

io.on('connection', function (socket) {
    console.log('a user connected');

    socket.on('control', (data) => {
        console.log("order:" + data);
        io.emit('control', data);
    })
});

http.listen(9003, function () {
    console.log('listening on *:9003');
});